package cn.hacynn.nd.mapper;

import cn.hacynn.nd.common.result.Result;
import cn.hacynn.nd.pojo.entity.Tag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author Hacynn
 * @Date 2024/5/27 14:47
 * @Version 1.0
 */
@Mapper
public interface TagMapper extends BaseMapper<Tag> {

    /**
     * 根据userId获取tags  文件夹
     * @param userId
     * @return
     */
    @Select("select * from tag where user_id = #{userId}")
    List<Tag> getByUserId(Long userId);

    /**
     * 根据标签名称和用户id获取标签信息
     * @param userId
     * @param name
     * @return
     */
    @Select("select * from tag where user_id = #{userId} and name = #{name}")
    Tag getByName(Long userId, String name);
}
